package com.ctshk.rpc.bus.mapper;

import java.time.LocalDate;
import java.util.List;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectProvider;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ctshk.rpc.bus.dto.BusProductCostPriceDTO;
import com.ctshk.rpc.bus.dto.BusProductCostPriceFullInfoDTO;
import com.ctshk.rpc.bus.entity.BusProductCostPrice;
import com.ctshk.rpc.bus.mapper.provider.BusProductCostPriceProvider;

/**
 * <p>
 * 巴士成本价格表 Mapper 接口
 * </p>
 *
 * @author 彭柳霖
 * @since 2021-02-19
 */
public interface BusProductCostPriceMapper extends BaseMapper<BusProductCostPrice> {

    /**
     * 根据产品成本id查询产品成本价格集合
     * @param busProductCostId
     * @return
     */
    @Select("<script>"+"select id,cost_id,boarding_station_id,s1.boarding_station_name,s1.alighting_station_id, \n" +
            "s1.alighting_station_name,s1.passenger_id,s1.passenger_name,s1.price,s1.number from t_bus_product_cost_price s1 \n"+
            "where s1.cost_id = #{busProductCostId} \n" +
            "</script>")
    List<BusProductCostPriceDTO> queryList(@Param("busProductCostId") Long busProductCostId);
    
    /**
     * 查询产品价格完整信息列表
     * @param productId
     * @param queryDate
     * @return
     */
    @SelectProvider(type = BusProductCostPriceProvider.class, method = "queryFullInfoList")
    List<BusProductCostPriceFullInfoDTO> queryFullInfoList(@Param("productId") Long productId, @Param("queryDate") LocalDate queryDate);
}
